package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.SalaryService;

public class AddAalaryController extends HttpServlet{
    SalaryService  salaryservice=new SalaryService();
	@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	doPost(req, resp);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	req.setCharacterEncoding("utf8");
    	resp.setCharacterEncoding("utf8");
    	int wid=Integer.parseInt(req.getParameter("wid"));
    	String wname=req.getParameter("wname");
    	int did=Integer.parseInt(req.getParameter("did"));
    	int month=Integer.parseInt(req.getParameter("month"));
    	String salary=req.getParameter("salary");
    	String premium=req.getParameter("premium");
    	String deduct=req.getParameter("deduct");
    	//获取写回的笔
    	PrintWriter pw=resp.getWriter();
    	pw.write(String.valueOf(salaryservice.addSalary(wid, wname, did, month, salary, premium, deduct)));
    }
}
